<template>
	<view class="uiwu">
		<uiwu-list :loading="more">
			<view class="uiwu-list">
				<view class="uiwu-list-item" v-for="(item,index) in listData" :key="index">
					<view class="time">{{item.add_time}}</view>
					<view class="item">
						<view class="box">
							<view class="title">{{item.title}}</view>
							<view class="content uiwu-hidden2">{{item.content}}</view>
						</view>
					</view>
				</view>
			</view>
		</uiwu-list>
	</view>
</template>

<script setup lang="ts">
	import { onLoad , onReachBottom } from '@dcloudio/uni-app';
	import { uiwu } from '../../config/config';
	import { messagelist } from '../../api/api';
	import { ref } from 'vue';
	const listData = ref<Array<object>>([])
	const pageNum = ref<number>(1)
	const more = ref<string>('loading');
	const isLock = ref<boolean>(true)
	const getmoneylist = async (mack:boolean = false) : Promise<any> => {
		if(!mack) pageNum.value = 1
		const { data:{data , total}} = await messagelist({
			page:pageNum.value
		});
		isLock.value = true
		uiwu.setlist({
			isMore:mack,
			listData,
			total,
			listRow:data,
			more,
			pageNum
		})
	}
	/**
	 * 加载更多
	 */
	onReachBottom(()=>{
		if(!isLock.value) return 
		isLock.value = false
		pageNum.value++
		getmoneylist(true)
	})
	onLoad(()=>{
		getmoneylist()
	})
</script>

<style lang="scss">
	page{
		background-color: #F6F6F6;
	}
	.uiwu-list{
		padding: 0 24rpx;
		padding-right: 12rpx;
		&-item{
			.time{
				font-size: 24rpx;
				font-weight: 400;
				color: #444444;
				text-align: center;
				padding: 24rpx 0 32rpx;
			}
			.item{
				width: 100%;
				height: 206rpx;
				background: #FAC500;
				border-radius: 24rpx;
				border: 3rpx solid #231815;
				margin-bottom: 32rpx;
				.box{
					width: 100%;
					height: 206rpx;
					background: #FFFFFF;
					border-radius: 16rpx;
					border: 3rpx solid #231815;
					margin-top: -12rpx;
					margin-left: -12rpx;
					padding: 24rpx;
					.title{
						font-size: 32rpx;
						font-weight: 800;
						color: #231815;
					}
					.content{
						font-size: 28rpx;
						font-weight: 500;
						color: #666666;
						margin-top: 12rpx;
					}
				}
			}
		}
	}
</style>
